import java.util.Stack;

/**
 * Created with IntelliJ IDEA.
 * User: 12629
 * Date: 2021/11/2
 * Time: 10:26
 * Description:
 */
public class TestDemo2 {

    public static void main(String[] args) {
        MyStack stack = new MyStack ();
        stack.push(1);
        stack.push(2);
        stack.push(3);
        stack.push(4);
        int ret = stack.pop();//弹出栈顶元素【删除】
        System.out.println(ret);
        int ret2 = stack.peek();//获取栈顶元素，但是不删除
        System.out.println(ret2);
        System.out.println(stack.empty());
    }
    public static void main1(String[] args) {
        Stack<Integer> stack = new Stack<>();
        stack.push(1);
        stack.push(2);
        stack.push(3);
        stack.push(4);
        int ret = stack.pop();//弹出栈顶元素【删除】
        System.out.println(ret);
        int ret2 = stack.peek();//获取栈顶元素，但是不删除
        System.out.println(ret2);
        System.out.println(stack.empty());
    }
}
